
// 回到顶部功能
var gGooBack = document.getElementsByClassName('G-gooBack')[0];
var gFootSide = document.getElementsByClassName('G-footSide')[0];
// 显示右边栏底部

window.onscroll = function(){
 	if(window.pageYOffset>=632){
 		gFootSide.style.height = '76px';
 		gGooBack.style.height = '38px';
 	}else{
 		gFootSide.style.height = '38px';
 		gGooBack.style.height = '0px';
 	}
 }



gGooBack.onclick = function(){
  var gnum = 0;
            var scrollTop = document.documentElement.scrollTop;
		var	timer = setInterval(function(){
				gnum-=20;
				
				if((scrollTop+gnum)<= 0) {
					clearInterval(timer)
				}
				console.log(gnum)
				document.documentElement.scrollTop = scrollTop+gnum;
			},4)
}


// 右侧边栏第二hover仓库栏
var gonml = document.querySelectorAll('.G-onml');
var gonmlv = document.querySelectorAll('.G-onmlv');
var gRightside = document.querySelector('.G-rightside');
var gCha = document.querySelectorAll('.G-cha');
var gGouwucangku =document.querySelector('.G-gouwucangku');
var gMyfooter =document.querySelector('.G-myfooter');
var gTh =document.querySelectorAll('.G-th');
var gWC = document.querySelector('#G-wc');
var gon=0;

gonml[0].onclick = function(){
   gon++;
   if(gon==1){
   	gRightside.style.right = 280+'px';
    gGouwucangku.style.width = 280+'px';
    gMyfooter.style.width = 280+'px';
    gGouwucangku.style.zIndex = 30;
     gMyfooter.style.zIndex = 0;
    gTh[0].style.backgroundColor = '#f42424';
    gWC.style.backgroundColor='white';
    gWC.style.color='#f42424';
    gonml[4].style.backgroundColor = '#000';
    gons=0;
   }else{
    gRightside.style.right = 0+'px';
    gGouwucangku.style.width = 0+'px';
     gMyfooter.style.width = 0+'px';
    gGouwucangku.style.zIndex = 0;
    gTh[0].style.backgroundColor = '#000';
    gWC.style.backgroundColor='#f42424';
    gWC.style.color='white';
    gon=0;
   }
}



gCha[0].onclick = function(){
   gRightside.style.right = 0+'px';
   gGouwucangku.style.width = 0+'px';
    gTh[0].style.backgroundColor = '#000';
    gWC.style.backgroundColor='#f42424';
    gWC.style.color='white';
    gMyfooter.style.width = 0+'px';
     gon=0;
}
gCha[1].onclick = function(){
    gRightside.style.right = 0+'px';
    gMyfooter.style.width = 0+'px';
    gGouwucangku.style.width = 0+'px';
    gonml[4].style.backgroundColor = '#000';

}





var gons = 0;
gonml[4].onclick = function(){
	
   gons++;
   if(gons==1){
   	gRightside.style.right = 280+'px';
    gMyfooter.style.width = 280+'px';
    gGouwucangku.style.width = 280+'px';
    gTh[0].style.backgroundColor = '#000';
    gMyfooter.style.zIndex = 30;
    gGouwucangku.style.zIndex = 0;
    gWC.style.backgroundColor='#f42424';
    gonml[4].style.backgroundColor = '#f42424';
    gWC.style.color='white';
    gon=0;
   }else{
    gRightside.style.right = 0+'px';
    gMyfooter.style.width = 0+'px';
    gGouwucangku.style.width =0+'px';
    gMyfooter.style.zIndex =0;
    gonml[4].style.backgroundColor = '#000';
    gons=0
   }
}
// 右侧边栏第二hover仓库栏结束

// 邮箱订阅开始
var gYouxiangtiao = document.querySelector('.G-youxiangtiao');
var gpbx = document.querySelector('.G-pb-x');
var ggeshinogood = document.querySelector('.G-geshi-nogood');
var gdingyue = document.querySelector('.G-dingyue');
var gtuiding = document.querySelector('.G-tuiding');
var gemails = document.querySelector('.G-emailS');
var  gtiao = 0;
gonml[6].onclick = function(){
	gtiao++;
	if(gtiao==1){
		gYouxiangtiao.style.display = 'block';
	}else{
		gYouxiangtiao.style.display = 'none';
		gtiao=0;
	}

}
gdingyue.onclick = function(){
  if(gemails.value.trim().length==0){
    ggeshinogood.style.display = 'block';
  }

}
gtuiding.onclick = function(){
  if(gemails.value.trim().length==0){
    ggeshinogood.style.display = 'block';
  }

}
var genshi = 0;
gpbx.onclick =function(){
  // genshi++;
  // if(genshi==1){
  //  ggeshinogood.style.display = 'block';
  // }else{
   ggeshinogood.style.display = 'none';
    genshi=0;
  }

// 邮箱订阅结束


// 验证图片
var gyanzhengtu = document.querySelectorAll('.G-yanzheng-tu');
var gyanzhengchi = document.querySelector('.G-yanzhengma-chi');


var gyantu = 0;

	gyanzhengchi.onclick = function(){
		console.log(2)
	gyantu++;
	if(gyantu==3){
		gyantu=0;
	}
	for(var j=0;j<gyanzhengtu.length;j++){
		gyanzhengtu[j].style.zIndex = '0';
	}
	gyanzhengtu[gyantu].style.zIndex = '10';
}
// 验证图片结束

// 对号显示
var ggbo = document.querySelector('.G-G-bo');
var gm = document.querySelector('.G-m');
var gcheckbox = document.querySelector('.G-checkbook');
var gduihao=0;
gm.onclick = function(){
gduihao++;
if(gduihao==1){
	ggbo.style.display = 'block';
	gcheckbox.style.color = '#f42424';
	gm.style.borderColor = '#f42424';

}else{
	ggbo.style.display = 'none';
	gduihao=0;
	gcheckbox.style.color = '#555';
	gm.style.borderColor = '#8c8c8c';


}
}

// 	gcheckbox.onmouseover = function(){
// 	gcheckbox.style.color = '#f42424';
// 	gm.style.borderColor = '#f42424';
// }

// gcheckbox.onmouseout = function(){
// 	gcheckbox.style.color = '#555';
// 	gm.style.borderColor = '#8c8c8c';

     
// }

// var ggbo = document.querySelector('.G-G-bo');
// / 对号显示結束


// 输入框功能
var gshurukuang = document.querySelectorAll('.G-shurukuang');
var gloaddenglu = document.querySelector('.G-load-denglu');
var gmsgtip = document.querySelector('.G-msg-tip');
console.log(gshurukuang);


for(var i=0;i<gshurukuang.length;i++){
	gshurukuang
}
gloaddenglu.onclick = function(){
	if(gshurukuang[0].value.trim().length==0){
           gmsgtip.innerText = '请输入用户名';
           gshurukuang[0].style.borderColor = '#f42424';
	}else if(gshurukuang[1].value.trim().length==0){
		gmsgtip.innerText = '请输入密码';
		gshurukuang[1].style.borderColor = '#f42424';
	}else if(gshurukuang[2].value.trim().length==0){
		gmsgtip.innerText = '请输入验证码';
		gshurukuang[2].style.borderColor = '#f42424';
	}
}


// 点叉功能
var gnoloadcha = document.querySelector('.G-noload-cha');
var gweidenglubox = document.querySelector('.G-weidenglu-box');

gnoloadcha.onclick = function(){
   gweidenglubox.style.display = 'none';
}




gonml[1].onclick = function(){
 gweidenglubox.style.display = 'block';
}
gonml[2].onclick = function(){
	 gweidenglubox.style.display = 'block';
}
gonml[3].onclick = function(){
	 gweidenglubox.style.display = 'block';
}
gonml[5].onclick = function(){
	 gweidenglubox.style.display = 'block';
}
